// Author: wsfuyibing <682805@qq.com>
// Date: 2025-05-01

package withdrawaled

import (
	"server/app/http/models"
	"server/app/kind"
)

type Response struct {
	Amount     string
	State      kind.WithdrawalState
	StateText  string
	OutTradeNo string
	Datetime   string
}

func NewResponse() *Response {
	return &Response{}
}

func (o *Response) With(m *models.BalanceWithdrawal) *Response {
	o.Amount = m.Amount.String()
	o.State = m.State
	o.StateText = m.State.Text()
	o.OutTradeNo = m.OutTradeNo
	o.Datetime = m.CreatedAt.Time().Format("2006/01/02 15:04")
	return o
}
